import pygame
import sys

pygame.init()
screen = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()
running = True


def draw_shape():
    # 画点
    pygame.draw.circle(screen, "red", (200, 50), 2)
    # 画线
    pygame.draw.line(screen, "green", (200, 100), (400, 100), 3)
    # 三角形
    pygame.draw.polygon(screen, "red", ((300, 50), (300, 100), (350, 50)), 2)
    # 圆
    pygame.draw.circle(screen, "yellow", (200, 200), 50, 2)
    # 椭圆 --> 四元组 (x, y, width, height)
    pygame.draw.ellipse(screen, "orange", (200, 250, 50, 70), 2)
    # 矩形 --> 四元组 (x, y, width, height)
    pygame.draw.rect(screen, "black", (200, 300, 50, 80), 2)
    # 正方形 --> 四元组 (x, y, width, height)
    pygame.draw.rect(screen, "purple", (200, 400, 50, 50), 2)


while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        else:
            print(event)

    # 屏幕填充颜色
    screen.fill("blue")

    draw_shape()

    # 刷新屏幕
    pygame.display.flip()
    clock.tick(60)  # 限制fps 30帧
